package com.astn.bks.util;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

import android.app.DatePickerDialog;
import android.app.DatePickerDialog.OnDateSetListener;
import android.app.Dialog;
import android.content.Context;
import android.widget.DatePicker;

public class DateUtils {
	public static Date pickedDate;
	public static SimpleDateFormat quoteDateFormat = new SimpleDateFormat(
			"yyyy-MM-dd");

	private static class MDateSetListener implements OnDateSetListener {

		@Override
		public void onDateSet(DatePicker view, int year, int monthOfYear,
				int dayOfMonth) {
			Calendar cal = GregorianCalendar.getInstance();
			cal.set(year, monthOfYear, dayOfMonth);
			pickedDate = cal.getTime();
		}

	}

	public static Dialog createDatePickerDialog(Context ct) {
		Calendar c = Calendar.getInstance();
		int year = c.get(Calendar.YEAR);
		int month = c.get(Calendar.MONTH);
		int day = c.get(Calendar.DAY_OF_MONTH);
		return new DatePickerDialog(ct, new MDateSetListener(), year, month,
				day);
	}

}
